<?php

namespace Yolo\Components\Middleware\Middlewares;

use Yolo\Components\Middleware\AbstractMiddleware;
use Yolo\Service\RpcRequest;
use Yolo\Service\RpcResponse;

/**
 * Set the response header Content-Type to application/json.
 * @extends AbstractMiddleware
 * @author <LUSHAOMING> <lushaoming6@gmail.com>
 * @date 2024-12-04
 */
class JsonResponseMiddleware extends AbstractMiddleware
{
    public function handle(RpcRequest $request, RpcResponse $response, $next): mixed
    {
        $response->setHeader('Content-Type', 'application/json');
        return $next($request, $response);
    }
}
